/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package org.quality4spl.fm.cvm.impl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

import org.quality4spl.fm.cvm.*;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class CvmFactoryImpl extends EFactoryImpl implements CvmFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static CvmFactory init() {
		try {
			CvmFactory theCvmFactory = (CvmFactory)EPackage.Registry.INSTANCE.getEFactory("http:///de/mopr/cvm.ecore"); 
			if (theCvmFactory != null) {
				return theCvmFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new CvmFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CvmFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case CvmPackage.VARIABILITY_MODEL: return createVariabilityModel();
			case CvmPackage.VARIABILITY_MODEL_FOLDER: return createVariabilityModelFolder();
			case CvmPackage.FEATURE_DIAGRAM: return createFeatureDiagram();
			case CvmPackage.FEATURE_MODEL: return createFeatureModel();
			case CvmPackage.FEATURE: return createFeature();
			case CvmPackage.CARDINALITY: return createCardinality();
			case CvmPackage.INTERVAL: return createInterval();
			case CvmPackage.FEATURE_GROUP: return createFeatureGroup();
			case CvmPackage.FEATURE_LINK: return createFeatureLink();
			case CvmPackage.FEATURE_CONSTRAINT: return createFeatureConstraint();
			case CvmPackage.DEVIATION_ATTRIBUTE_SET: return createDeviationAttributeSet();
			case CvmPackage.CONFIG_DECISION_MODEL: return createConfigDecisionModel();
			case CvmPackage.CONFIG_DECISION: return createConfigDecision();
			case CvmPackage.CONFIG_DECISION_FOLDER: return createConfigDecisionFolder();
			case CvmPackage.FEATURE_CONFIGURATION: return createFeatureConfiguration();
			case CvmPackage.USER_ATTRIBUTE_TYPE: return createUserAttributeType();
			case CvmPackage.USER_ATTRIBUTE_VALUE: return createUserAttributeValue();
			case CvmPackage.STRING_CONSTRAINING_TYPE: return createStringConstrainingType();
			case CvmPackage.FEATURE_MODEL_PROTOTYPE: return createFeatureModelPrototype();
			case CvmPackage.VARIABLE_ENTITY: return createVariableEntity();
			case CvmPackage.VARIABLE_PROPERTY: return createVariableProperty();
			case CvmPackage.VARIABLE_ENTITY_PART: return createVariableEntityPart();
			case CvmPackage.ENTITY_CONFIGURATION: return createEntityConfiguration();
			case CvmPackage.CDM_APPLICATION: return createCDMApplication();
			case CvmPackage.USER_ATTRIBUTE_TYPE_CONTEXT: return createUserAttributeTypeContext();
			case CvmPackage.VARIABILITY_DIAGRAM: return createVariabilityDiagram();
			case CvmPackage.NAME_SEQUENCE: return createNameSequence();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case CvmPackage.COMPLIANCE_LEVEL:
				return createComplianceLevelFromString(eDataType, initialValue);
			case CvmPackage.DEVIATION_PERMISSION:
				return createDeviationPermissionFromString(eDataType, initialValue);
			case CvmPackage.PRIMITIVE_TYPE:
				return createPrimitiveTypeFromString(eDataType, initialValue);
			case CvmPackage.VISIBILITY:
				return createVisibilityFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case CvmPackage.COMPLIANCE_LEVEL:
				return convertComplianceLevelToString(eDataType, instanceValue);
			case CvmPackage.DEVIATION_PERMISSION:
				return convertDeviationPermissionToString(eDataType, instanceValue);
			case CvmPackage.PRIMITIVE_TYPE:
				return convertPrimitiveTypeToString(eDataType, instanceValue);
			case CvmPackage.VISIBILITY:
				return convertVisibilityToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public VariabilityModel createVariabilityModel() {
		VariabilityModelImpl variabilityModel = new VariabilityModelImpl();
		return variabilityModel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public VariabilityModelFolder createVariabilityModelFolder() {
		VariabilityModelFolderImpl variabilityModelFolder = new VariabilityModelFolderImpl();
		return variabilityModelFolder;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureDiagram createFeatureDiagram() {
		FeatureDiagramImpl featureDiagram = new FeatureDiagramImpl();
		return featureDiagram;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureModel createFeatureModel() {
		FeatureModelImpl featureModel = new FeatureModelImpl();
		return featureModel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Feature createFeature() {
		FeatureImpl feature = new FeatureImpl();
		return feature;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Cardinality createCardinality() {
		CardinalityImpl cardinality = new CardinalityImpl();
		return cardinality;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Interval createInterval() {
		IntervalImpl interval = new IntervalImpl();
		return interval;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureGroup createFeatureGroup() {
		FeatureGroupImpl featureGroup = new FeatureGroupImpl();
		return featureGroup;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureLink createFeatureLink() {
		FeatureLinkImpl featureLink = new FeatureLinkImpl();
		return featureLink;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureConstraint createFeatureConstraint() {
		FeatureConstraintImpl featureConstraint = new FeatureConstraintImpl();
		return featureConstraint;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DeviationAttributeSet createDeviationAttributeSet() {
		DeviationAttributeSetImpl deviationAttributeSet = new DeviationAttributeSetImpl();
		return deviationAttributeSet;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConfigDecisionModel createConfigDecisionModel() {
		ConfigDecisionModelImpl configDecisionModel = new ConfigDecisionModelImpl();
		return configDecisionModel;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConfigDecision createConfigDecision() {
		ConfigDecisionImpl configDecision = new ConfigDecisionImpl();
		return configDecision;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ConfigDecisionFolder createConfigDecisionFolder() {
		ConfigDecisionFolderImpl configDecisionFolder = new ConfigDecisionFolderImpl();
		return configDecisionFolder;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureConfiguration createFeatureConfiguration() {
		FeatureConfigurationImpl featureConfiguration = new FeatureConfigurationImpl();
		return featureConfiguration;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UserAttributeType createUserAttributeType() {
		UserAttributeTypeImpl userAttributeType = new UserAttributeTypeImpl();
		return userAttributeType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UserAttributeValue createUserAttributeValue() {
		UserAttributeValueImpl userAttributeValue = new UserAttributeValueImpl();
		return userAttributeValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public StringConstrainingType createStringConstrainingType() {
		StringConstrainingTypeImpl stringConstrainingType = new StringConstrainingTypeImpl();
		return stringConstrainingType;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public FeatureModelPrototype createFeatureModelPrototype() {
		FeatureModelPrototypeImpl featureModelPrototype = new FeatureModelPrototypeImpl();
		return featureModelPrototype;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public VariableEntity createVariableEntity() {
		VariableEntityImpl variableEntity = new VariableEntityImpl();
		return variableEntity;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public VariableProperty createVariableProperty() {
		VariablePropertyImpl variableProperty = new VariablePropertyImpl();
		return variableProperty;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public VariableEntityPart createVariableEntityPart() {
		VariableEntityPartImpl variableEntityPart = new VariableEntityPartImpl();
		return variableEntityPart;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EntityConfiguration createEntityConfiguration() {
		EntityConfigurationImpl entityConfiguration = new EntityConfigurationImpl();
		return entityConfiguration;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CDMApplication createCDMApplication() {
		CDMApplicationImpl cdmApplication = new CDMApplicationImpl();
		return cdmApplication;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public UserAttributeTypeContext createUserAttributeTypeContext() {
		UserAttributeTypeContextImpl userAttributeTypeContext = new UserAttributeTypeContextImpl();
		return userAttributeTypeContext;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public VariabilityDiagram createVariabilityDiagram() {
		VariabilityDiagramImpl variabilityDiagram = new VariabilityDiagramImpl();
		return variabilityDiagram;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NameSequence createNameSequence() {
		NameSequenceImpl nameSequence = new NameSequenceImpl();
		return nameSequence;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ComplianceLevel createComplianceLevelFromString(EDataType eDataType, String initialValue) {
		ComplianceLevel result = ComplianceLevel.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertComplianceLevelToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public DeviationPermission createDeviationPermissionFromString(EDataType eDataType, String initialValue) {
		DeviationPermission result = DeviationPermission.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertDeviationPermissionToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PrimitiveType createPrimitiveTypeFromString(EDataType eDataType, String initialValue) {
		PrimitiveType result = PrimitiveType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertPrimitiveTypeToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Visibility createVisibilityFromString(EDataType eDataType, String initialValue) {
		Visibility result = Visibility.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertVisibilityToString(EDataType eDataType, Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public CvmPackage getCvmPackage() {
		return (CvmPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static CvmPackage getPackage() {
		return CvmPackage.eINSTANCE;
	}

} //CvmFactoryImpl
